<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
</head>
<body>
<!--
    这里包含了每个页面的公共模块
-->
<!--头部 导航条模块-->
<div class="layui-header header" th:fragment="head">
    <script>
        //        <![CDATA[
        var layer;
        layui.use(["layer", "element"], function () {
            layer = layui.layer;
        });
        //JavaScript代码区域
        //        ]]>
    </script>
    <div class="layui-main">
        <a class="logo" href="/index.html">
            <img th:src="@{/image/logo.png}"/>
        </a>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <!--<ul class="layui-nav layui-layout-left">-->
        <!---->
        <!--</ul>-->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item" style="color:#393D49;">
                <a href="javascript:;">分类</a>
                <dl class="layui-nav-child" id="category">

                </dl>
                <script>
                    //                    <![CDATA[
                    //加载分类
                    $.get("/admin/classification/list.do?type=1&pageindex=-1", function (data) {
                        if (data.state == 0) {
                            var list = $("#category");
                            $(data.data).each(function (index, item) {
                                var cat = $("<dd><a href='/product/category.html?cid=" + item.id + "'>" + item.cname + "</a></dd>");
                                list.append(cat);
                            })
                        } else {
                            alert(data.message);
                        }
                    });
                    //                    ]]>
                </script>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <i class="fa fa-user-circle"></i>&nbsp;
                    <span th:if="${session.user == null}">请登陆</span>
                    <span th:if="${session.user != null}" th:text="'欢迎您!&nbsp;' + ${session.user.username}">请登陆</span>
                </a>
                <dl class="layui-nav-child">
                    <dd th:if="${session.user != null}"><a href="/user/logout.do"><i class="fa fa-sign-out"></i>
                        退出登录</a></dd>
                    <dd th:if="${session.user != null}"><a href="/order/toList.html"><i class="fa fa-list"></i> 我的订单</a>
                    </dd>
                    <dd th:if="${session.user != null}"><a href="/product/toCart.html"><i
                            class="fa fa-shopping-cart"></i> 购物车</a></dd>
                    <dd th:if="${session.user == null}"><a href="/user/toLogin.html"><i class="fa fa-sign-in"></i>
                        登录</a></dd>
                    <dd th:if="${session.user == null}"><a href="/user/toRegister.html"><i class="fa fa-user-plus"></i>
                        注册</a></dd>
                </dl>
            </li>
            <!--<li class="layui-nav-item"><a href="">退了</a></li>-->
        </ul>
    </div>
</div>

<!--底部模块-->
<div class="footer footer-index" th:fragment="foot">
    <!--    <hr style="color: #c2c2c2;" />-->
    <!-- 底部固定区域 -->
    © Lyscms<sup>+</sup> code 2020 power by <a style="color: white;font-size: 13px;" href="https://www.lyscms.info">亮月网
    lyscms+</a>
    <a style="color: white;font-size: 13px;" href="/admin/toLogin.html">后台管理系统入口</a>
</div>

</body>
</html>
